package com.dz.swagger;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@Configuration
@EnableSwagger2
public class swagger2 {
    //    启动项目访问 http://localhost:8080/swagger-ui.html
    @Bean
    public Docket webApiConfig(){

        return new Docket(DocumentationType.SWAGGER_2)
                .groupName("webApi")
                .apiInfo(webApiInfo())
                .select()
                .paths(PathSelectors.any())
                .build();

    }

    private ApiInfo webApiInfo(){

        return new ApiInfoBuilder()
                .title("赵虎的API文档")
                .description("用来练习的文档")
                .version("1.0")
                .licenseUrl("www.baidu.com")
                .contact("Author")
                .termsOfServiceUrl("www.baidu.com")
                .build();
    }


    @Bean //配置docket以配置Swagger具体参数
    public Docket docket() {
        return new Docket(DocumentationType.SWAGGER_2);
    }

    @Bean //配置docket以配置Swagger具体参数
    public Docket docket01() {

        return new Docket(DocumentationType.SWAGGER_2).groupName("a");
    }
    @Bean //配置docket以配置Swagger具体参数
    public Docket docket02() {

        return new Docket(DocumentationType.SWAGGER_2).groupName("b");
    }
    @Bean //配置docket以配置Swagger具体参数
    public Docket docket03() {
        return new Docket(DocumentationType.SWAGGER_2).groupName("c");
    }




}
